Dynomotion

Group: DynoMotion Message: 9946 From: dotma99 Date: 8/10/2014
Subject: G code error, G code aborted after upgrade from 430 to 432

I have just upgraded from 430 to 432, and gone through, I think, the correct steps including creating a new init.c file from pasting in the axes.

 

I can jog, and I can home using my c home program, but whenever I try and run a program or issue a move instruction in the command window, I get this error,G code error, G code aborted with nothing in the console.

 

I do have "DefineCoordSystem6(0,1,2,4,5,-1);"  in the init.c file which is copied below..

 

Help - I have been using this for over two years and I am baffled!

 

thanks

 

Edward

 

INIT.c:

#include "KMotionDef.h"

int sRes;

main()
{
SetBitDirection (1040,1);
ClearBit(1040);  //This stops AB axes from homing
FPGA(STEP_PULSE_LENGTH_ADD)= 63 + 0x40;   //=32 + 0x40;
persist.UserData[3] = 0;  //for drill break

int XYVel  = 20000; //was 30000
int XYAcc  = 2000000; //was 3000000
int XYJerk = 20000000; //was 40000000

int ZVel  = 30000; //40000
int ZAcc  = 3000000;//4000000
int ZJerk = 30000000;//10000000

int ABVel  = 20000;
int ABAcc  = 200000;
int ABJerk = 2000000;

//Microstep 64
//steps per rev 12,800
//Pulley circumference 50mm
//counts per inch: 6502.413
//counts per mm: 256
//set max Vel at 5m/min = 83.33 mm/sec = 83.33 x 256 = 21332.5 counts per sec
//set max Vel at 10m/min = 166.66 mm/sec = 166.66 x 256 = 68265 counts per sec
//Acceleration 1G = 9750mm/sec = 2,496,000


//Z axis 54mm per rotation
//Micro step 64
//steps per rev 12,800
//pulley ratio = 1.89
//counts per mm 250.98 /1.89 = 132.79
//counts per inch 6374.89 / 1.89 = 3373.48
//or 132.8 cpmm
//top speed 7mm in 60ms = 116 mm/s or 7000 mm/min
//or 278.9 inches per min or
// or 15312 cps or 4.63 in/sec
//???Z is 25.6cpm
SetBitDirection (50,1);  //used to store disable all axes on Z limit
SetBitDirection (51,1); //used to store tool number
SetBitDirection (52,1); 
SetBitDirection (53,1); 
SetBitDirection (54,1); 
SetBitDirection (55,1); 
SetBitDirection (56,1); 
ClearBit (50);

SetBitDirection(154,1);  //Stepper power
SetBitDirection(160,1);  //spindle on/off
SetBitDirection(152,1);  //aux power for vac
SetBitDirection(153,1);  //Pneumatic for Tool change
SetBitDirection(144,1); 
SetBitDirection(145,1);
SetBitDirection(146,1);
SetBitDirection(147,1); //SMS Error
SetBitDirection(151,1); //SMS End cycle

int ZupLimit = 17;
//int ZdownLimit = 16; //check this
int AALimit = 19;
int BBLimit = 16;
int eStop = 140;
int XLimit = 137;
int Y1Limit = 138;
int Y2Limit = 143;
int TCLimit = 141;

SetBitDirection(eStop,0); 
SetBitDirection(BBLimit,0);  
SetBitDirection(ZupLimit,0);
//SetBitDirection(ZdownLimit,0); 
SetBitDirection(AALimit,0); 
SetBitDirection(XLimit,0);  
SetBitDirection(Y1Limit,0);  
SetBitDirection(Y2Limit,0);  
SetBitDirection(TCLimit,0);  

SetBitDirection(30,1);  //Aux 2
SetBitDirection(31,1); //XYZ power
SetBitDirection(34,1);  //Aux 1
SetBitDirection(35,1);  //AB power

//All axes
 ch0->InputMode=NO_INPUT_MODE;
 ch0->OutputMode=STEP_DIR_MODE;
 ch0->Vel=XYVel;
 ch0->Accel=XYAcc;
 ch0->Jerk=XYJerk;
 ch0->P=0;
 ch0->I=0.01;
 ch0->D=0;
 ch0->FFAccel=0;
 ch0->FFVel=0;
 ch0->MaxI=200;
 ch0->MaxErr=1e+006;
 ch0->MaxOutput=200;
 ch0->DeadBandGain=1;
 ch0->DeadBandRange=0;
 ch0->InputChan0=0;
 ch0->InputChan1=0;
 ch0->OutputChan0=4;
 ch0->OutputChan1=1;
 ch0->MasterAxis=-1;
 ch0->LimitSwitchOptions=0x113;
 ch0->LimitSwitchNegBit=137;
 ch0->LimitSwitchPosBit=137;
 ch0->SoftLimitPos=1e+030;
 ch0->SoftLimitNeg=-1e+030;
 ch0->InputGain0=1;
 ch0->InputGain1=1;
 ch0->InputOffset0=0;
 ch0->InputOffset1=0;
 ch0->OutputGain=-1;
 ch0->OutputOffset=0;
 ch0->SlaveGain=1;
 ch0->BacklashMode=BACKLASH_OFF;
 ch0->BacklashAmount=0;
 ch0->BacklashRate=0;
 ch0->invDistPerCycle=1;
 ch0->Lead=0;
 ch0->MaxFollowingError=1000000000;
 ch0->StepperAmplitude=20;

 ch0->iir[0].B0=1;
 ch0->iir[0].B1=0;
 ch0->iir[0].B2=0;
 ch0->iir[0].A1=0;
 ch0->iir[0].A2=0;

 ch0->iir[1].B0=1;
 ch0->iir[1].B1=0;
 ch0->iir[1].B2=0;
 ch0->iir[1].A1=0;
 ch0->iir[1].A2=0;

 ch0->iir[2].B0=0.000769;
 ch0->iir[2].B1=0.001538;
 ch0->iir[2].B2=0.000769;
 ch0->iir[2].A1=1.92081;
 ch0->iir[2].A2=-0.923885;
 
 ch1->InputMode=NO_INPUT_MODE;
 ch1->OutputMode=STEP_DIR_MODE;
 ch1->Vel=XYVel;
 ch1->Accel=XYAcc;
 ch1->Jerk=XYJerk;
 ch1->P=0;
 ch1->I=0.01;
 ch1->D=0;
 ch1->FFAccel=0;
 ch1->FFVel=0;
 ch1->MaxI=200;
 ch1->MaxErr=1e+006;
 ch1->MaxOutput=200;
 ch1->DeadBandGain=1;
 ch1->DeadBandRange=0;
 ch1->InputChan0=0;
 ch1->InputChan1=0;
 ch1->OutputChan0=5;
 ch1->OutputChan1=1;
 ch1->MasterAxis=-1;
 ch1->LimitSwitchOptions=0x113;
 ch1->LimitSwitchNegBit=138;
 ch1->LimitSwitchPosBit=138;
 ch1->SoftLimitPos=1e+030;
 ch1->SoftLimitNeg=-1e+030;
 ch1->InputGain0=1;
 ch1->InputGain1=1;
 ch1->InputOffset0=0;
 ch1->InputOffset1=0;
 ch1->OutputGain=-1;
 ch1->OutputOffset=0;
 ch1->SlaveGain=1;
 ch1->BacklashMode=BACKLASH_OFF;
 ch1->BacklashAmount=0;
 ch1->BacklashRate=0;
 ch1->invDistPerCycle=1;
 ch1->Lead=0;
 ch1->MaxFollowingError=1000000000;
 ch1->StepperAmplitude=20;

 ch1->iir[0].B0=1;
 ch1->iir[0].B1=0;
 ch1->iir[0].B2=0;
 ch1->iir[0].A1=0;
 ch1->iir[0].A2=0;

 ch1->iir[1].B0=1;
 ch1->iir[1].B1=0;
 ch1->iir[1].B2=0;
 ch1->iir[1].A1=0;
 ch1->iir[1].A2=0;

 ch1->iir[2].B0=0.000769;
 ch1->iir[2].B1=0.001538;
 ch1->iir[2].B2=0.000769;
 ch1->iir[2].A1=1.92081;
 ch1->iir[2].A2=-0.923885;

 ch2->InputMode=NO_INPUT_MODE;
 ch2->OutputMode=STEP_DIR_MODE;
 
 ch2->Vel=ZVel;
 ch2->Accel= ZAcc;
 ch2->Jerk=ZJerk;
 ch2->P=0;
 ch2->I=0.01;
 ch2->D=0;
 ch2->FFAccel=0;
 ch2->FFVel=0;
 ch2->MaxI=200;
 ch2->MaxErr=1e+006;
 ch2->MaxOutput=200;
 ch2->DeadBandGain=1;
 ch2->DeadBandRange=0;
 ch2->InputChan0=0;
 ch2->InputChan1=0;
 ch2->OutputChan0=6;
 ch2->OutputChan1=1;
 ch2->MasterAxis=-1;
 ch2->LimitSwitchOptions=0x113;
 ch2->LimitSwitchNegBit=141;
 ch2->LimitSwitchPosBit=141;
 ch2->SoftLimitPos=1e+030;
 ch2->SoftLimitNeg=-1e+030;
 ch2->InputGain0=1;
 ch2->InputGain1=1;
 ch2->InputOffset0=0;
 ch2->InputOffset1=0;
 ch2->OutputGain=1;
 ch2->OutputOffset=0;
 ch2->SlaveGain=1;
 ch2->BacklashMode=BACKLASH_OFF;
 ch2->BacklashAmount=0;
 ch2->BacklashRate=0;
 ch2->invDistPerCycle=1;
 ch2->Lead=0;
 ch2->MaxFollowingError=1000000000;
 ch2->StepperAmplitude=20;

 ch2->iir[0].B0=1;
 ch2->iir[0].B1=0;
 ch2->iir[0].B2=0;
 ch2->iir[0].A1=0;
 ch2->iir[0].A2=0;

 ch2->iir[1].B0=1;
 ch2->iir[1].B1=0;
 ch2->iir[1].B2=0;
 ch2->iir[1].A1=0;
 ch2->iir[1].A2=0;

 ch2->iir[2].B0=0.000769;
 ch2->iir[2].B1=0.001538;
 ch2->iir[2].B2=0.000769;
 ch2->iir[2].A1=1.92081;
 ch2->iir[2].A2=-0.923885;

 ch3->InputMode=NO_INPUT_MODE;
 ch3->OutputMode=STEP_DIR_MODE;
 ch3->Vel=XYVel;
 ch3->Accel=XYAcc;
 ch3->Jerk=XYJerk;
 ch3->P=0;
 ch3->I=0.01;
 ch3->D=0;
 ch3->FFAccel=0;
 ch3->FFVel=0;
 ch3->MaxI=200;
 ch3->MaxErr=1e+006;
 ch3->MaxOutput=200;
 ch3->DeadBandGain=1;
 ch3->DeadBandRange=0;
 ch3->InputChan0=3;
 ch3->InputChan1=0;
 ch3->OutputChan0=7;
 ch3->OutputChan1=0;
 ch3->MasterAxis=1;
 ch3->LimitSwitchOptions=0x113;
 ch3->LimitSwitchNegBit=143;
 ch3->LimitSwitchPosBit=143;
 ch3->SoftLimitPos=1e+030;
 ch3->SoftLimitNeg=-1e+030;
 ch3->InputGain0=1;
 ch3->InputGain1=1;
 ch3->InputOffset0=0;
 ch3->InputOffset1=0;
 ch3->OutputGain=1;
 ch3->OutputOffset=0;
 ch3->SlaveGain=-1;
 ch3->BacklashMode=BACKLASH_OFF;
 ch3->BacklashAmount=0;
 ch3->BacklashRate=0;
 ch3->invDistPerCycle=1;
 ch3->Lead=0;
 ch3->MaxFollowingError=1000000000;
 ch3->StepperAmplitude=20;

 ch3->iir[0].B0=1;
 ch3->iir[0].B1=0;
 ch3->iir[0].B2=0;
 ch3->iir[0].A1=0;
 ch3->iir[0].A2=0;

 ch3->iir[1].B0=1;
 ch3->iir[1].B1=0;
 ch3->iir[1].B2=0;
 ch3->iir[1].A1=0;
 ch3->iir[1].A2=0;

 ch3->iir[2].B0=0.000769;
 ch3->iir[2].B1=0.001538;
 ch3->iir[2].B2=0.000769;
 ch3->iir[2].A1=1.92081;
 ch3->iir[2].A2=-0.923885;

 ch4->InputMode=NO_INPUT_MODE;
 ch4->OutputMode=STEP_DIR_MODE;
 ch4->Vel=ABVel;
 ch4->Accel=ABAcc ;
 ch4->Jerk=ABJerk;
 ch4->P=0.2;
 ch4->I=0;
 ch4->D=0;
 ch4->FFAccel=0;
 ch4->FFVel=0;
 ch4->MaxI=200;
 ch4->MaxErr=200;
 ch4->MaxOutput=200;
 ch4->DeadBandGain=1;
 ch4->DeadBandRange=0;
 ch4->InputChan0=0;
 ch4->InputChan1=0;
 ch4->OutputChan0=0;
 ch4->OutputChan1=1;
 ch4->MasterAxis=-1;
 ch4->LimitSwitchOptions=0x113;
 ch4->LimitSwitchNegBit=18;
 ch4->LimitSwitchPosBit=19;
 ch4->SoftLimitPos=1e+030;
 ch4->SoftLimitNeg=-1e+030;
 ch4->InputGain0=1;
 ch4->InputGain1=1;
 ch4->InputOffset0=0;
 ch4->InputOffset1=0;
 ch4->OutputGain=-1;
 ch4->OutputOffset=0;
 ch4->SlaveGain=1;
 ch4->BacklashMode=BACKLASH_OFF;
 ch4->BacklashAmount=0;
 ch4->BacklashRate=0;
 ch4->invDistPerCycle=1;
 ch4->Lead=0;
 ch4->MaxFollowingError=10000000;
 ch4->StepperAmplitude=20;

 ch4->iir[0].B0=1;
 ch4->iir[0].B1=0;
 ch4->iir[0].B2=0;
 ch4->iir[0].A1=0;
 ch4->iir[0].A2=0;

 ch4->iir[1].B0=1;
 ch4->iir[1].B1=0;
 ch4->iir[1].B2=0;
 ch4->iir[1].A1=0;
 ch4->iir[1].A2=0;

 ch4->iir[2].B0=1;
 ch4->iir[2].B1=0;
 ch4->iir[2].B2=0;
 ch4->iir[2].A1=0;
 ch4->iir[2].A2=0;

 ch5->InputMode=NO_INPUT_MODE;
 ch5->OutputMode=STEP_DIR_MODE;
 ch5->Vel=ABVel;
 ch5->Accel=ABAcc;
 ch5->Jerk=ABJerk;
 ch5->P=0.2;
 ch5->I=0;
 ch5->D=0;
 ch5->FFAccel=0;
 ch5->FFVel=0;
 ch5->MaxI=200;
 ch5->MaxErr=200;
 ch5->MaxOutput=200;
 ch5->DeadBandGain=1;
 ch5->DeadBandRange=0;
 ch5->InputChan0=0;
 ch5->InputChan1=0;
 ch5->OutputChan0=2;
 ch5->OutputChan1=1;
 ch5->MasterAxis=-1;
 ch5->LimitSwitchOptions=0x113;
 ch5->LimitSwitchNegBit=19;
 ch5->LimitSwitchPosBit=18;
 ch5->SoftLimitPos=1e+030;
 ch5->SoftLimitNeg=-1e+030;
 ch5->InputGain0=1;
 ch5->InputGain1=1;
 ch5->InputOffset0=0;
 ch5->InputOffset1=0;
 ch5->OutputGain=1;
 ch5->OutputOffset=0;
 ch5->SlaveGain=1;
 ch5->BacklashMode=BACKLASH_OFF;
 ch5->BacklashAmount=0;
 ch5->BacklashRate=0;
 ch5->invDistPerCycle=1;
 ch5->Lead=0;
 ch5->MaxFollowingError=10000000;
 ch5->StepperAmplitude=20;

 ch5->iir[0].B0=1;
 ch5->iir[0].B1=0;
 ch5->iir[0].B2=0;
 ch5->iir[0].A1=0;
 ch5->iir[0].A2=0;

 ch5->iir[1].B0=1;
 ch5->iir[1].B1=0;
 ch5->iir[1].B2=0;
 ch5->iir[1].A1=0;
 ch5->iir[1].A2=0;

 ch5->iir[2].B0=1;
 ch5->iir[2].B1=0;
 ch5->iir[2].B2=0;
 ch5->iir[2].A1=0;
 ch5->iir[2].A2=0;

//X axis
EnableAxisDest(0,0);
//Y1 axis
EnableAxisDest(1,0);
//Y2 axis
EnableAxisDest(3,0);
//Z axis
EnableAxisDest(2,0);
//Axis A forward/back
EnableAxisDest(4,0);
//Axis B left/right
EnableAxisDest(5,0);

DefineCoordSystem6(0,1,2,4,5,-1);
CheckDoneBuf;

if (ch0->Enable && ch1->Enable && ch2->Enable && ch3->Enable && ch4->Enable && ch5->Enable)
{
printf("all channels enabled\n");
}

printf("initialised\n");


 for(;;)
 {
 if (ReadBit(140)==1)  //eStop button
 {
DisableAxis(0);
DisableAxis(1);
DisableAxis(3);
DisableAxis(2);
DisableAxis(4);
DisableAxis(5);
printf("eStop hit\n");
}

//this stops all axes if just on of the Y limits is hit
 if ((ReadBit(138) == 1)||(ReadBit(143) == 1))
 {
 DisableAxis(0);
 DisableAxis(1);
 DisableAxis(3);
 DisableAxis(2);
 DisableAxis(4);
 DisableAxis(5);
 }

if (ReadBit(50)==1)
{
 if (ReadBit(16)==1)   //Z axis safety limit
    {
   DisableAxis(0); 
   DisableAxis(1);
   DisableAxis(3);
   DisableAxis(2);
   DisableAxis(4);
   DisableAxis(5);
   SetBit(147);  //Send Error SMS
   Delay_sec(0.25);
   ClearBit(147);

   printf("Z axis limit switch hit\n");
   //sRes = ServiceConsole(0);
   }
  }
 }
}
 


Group: DynoMotion Message: 9948 From: Tom Kerekes Date: 8/10/2014
Subject: Re: G code error, G code aborted after upgrade from 430 to 432
Hi Edward,

I don't see anything obvious wrong.  After you get the error if you look on the KMotion Axis Screen are all of your 6 axes still enabled?

Regards
TK

Group: DynoMotion Message: 9950 From: dotma99 Date: 8/11/2014
Subject: Re: G code error, G code aborted after upgrade from 430 to 432

Hi Tom

 

Thanks for your very prompt reply.

 

Yes, the axes still show as being enabled after the error message.

 

To test, I went back to 430, and go the same error.

 

I then went back to 429 - and it works perfectly!

 

The set-up between the three versions is, so far as I know, identical.   FYI, I have removed the geo file from all versions and I have not touched the set-up files ever.

 

It is really strange since 430 worked fine for some time, before I went to 432.

 

To help my understanding, it would be good to uknow how settings are stored.

 

There appear to be three places where settings can go:

 

a) the init.c file

b)by the download channel button on kMotion/config and flash screen, and

c)on the kMotion step response screen.

 

Also, what settings does the Flash user memory button on the kmotionconfig screen download?

 

I suppose the key question is, does the init.c file contain all of the settings and does it overwrite everything else?

 

Presumably the axis parameters in kMotionCNC are dealt with differently and just relate distances/speeds/accel/jerk to steps. 

 

Is there something in the documentation which explains this;  I havn't been able to find anything.

 

 best

 

Edward

 


 

Group: DynoMotion Message: 9951 From: Tom Kerekes Date: 8/11/2014
Subject: Re: G code error, G code aborted after upgrade from 430 to 432
Hi Edward,

Sorry I don't know what the issue may be.

Whenever you switch to a different Version you must flash that Version of Firmware to KFLOP using the Flash "New Version" button using the KMotion.exe of the Version you want to use.  Then cycle power on KFLOP.  I assume you are doing this?

Your system is somewhat uncommon in that it has 5 axes.  Please try temporarily changing to 3 axes to isolate if it is something related.  All you should need to change is:

DefineCoordSystem6(0,1,2,4,5,-1);

to

DefineCoordSystem6(0,1,2,-1,-1,-1);

Does GCode Execute in Simulation Mode?  What GCode are you trying?  Single Step?

You might try our latest Test Version 4.33c
http://dynomotion.com/Software/KMotion433cc.exe

The Flash User Data basically flashes the current KFLOP Memory.  We don't recommend you use it at all.  Your Initialize C Program should do everything required to take KFLOP from the default state to your required state.

Regarding your a,b,c question.  Actually b and c are the same.  Downloading parameters from KMotion.exe download the parameters for the axes channel that are defined on the 3 screens: Config, Step Response, and Filters.  "Move" on the Step Response Screen also perform a Download.  This Flash Video may help:


Regards
TK




From: "edward@... [DynoMotion]" <DynoMotion@yahoogroups.com>
To: DynoMotion@yahoogroups.com
Sent: Monday, August 11, 2014 3:49 AM
Subject: Re: [DynoMotion] G code error, G code aborted after upgrade from 430 to 432

 
Hi Tom
 
Thanks for your very prompt reply.
 
Yes, the axes still show as being enabled after the error message.
 
To test, I went back to 430, and go the same error.
 
I then went back to 429 - and it works perfectly!
 
The set-up between the three versions is, so far as I know, identical.   FYI, I have removed the geo file from all versions and I have not touched the set-up files ever.
 
It is really strange since 430 worked fine for some time, before I went to 432.
 
To help my understanding, it would be good to uknow how settings are stored.
 
There appear to be three places where settings can go:
 
a) the init.c file
b)by the download channel button on kMotion/config and flash screen, and
c)on the kMotion step response screen.
 
Also, what settings does the Flash user memory button on the kmotionconfig screen download?
 
I suppose the key question is, does the init.c file contain all of the settings and does it overwrite everything else?
 
Presumably the axis parameters in kMotionCNC are dealt with differently and just relate distances/speeds/accel/jerk to steps. 
 
Is there something in the documentation which explains this;  I havn't been able to find anything.
 
 best
 
Edward
 

 


Group: DynoMotion Message: 9952 From: dotma99 Date: 8/12/2014
Subject: Re: G code error, G code aborted after upgrade from 430 to 432
Hi Tom
Thanks, the change to 433c worked.  Not sure what I did wrong, but it wasn't the init.c file.  I suspect I caused the problem by copying across the Data directory.
best
Edward